﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using CommunitySystemModel;
using NPOI.HSSF.UserModel;

namespace CommunitySystem.Web.Service
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“PublicOfficialSelectionService”。
    public class PublicOfficialSelectionService : IPublicOfficialSelectionService
    {
        private PublicOfficialSelectionBO bo = new PublicOfficialSelectionBO();

        public  bool UpdatePublicOfficialInfoLocked(int id,int isLocked)
        {
            return bo.UpdatePublicOfficialInfoLocked(id,isLocked);
        }

        public FileTransferStream GetExcelFile(ObservableCollection<PublicOfficialRecordModel> models,  string username, Dictionary<string, bool> dic)
        {
            return bo.GetExcelFile(models, username, dic);
        }
        public ObservableCollection<PublicOfficialSelectionModel> GetPublicOfficialSelection(string OrgID, int ID, int start, int end, int status, int year, string islocked, int ExameID)
        {
            return bo.GetPublicOfficialSelection(OrgID, ID, start, end, status, year,islocked, ExameID);
        }

        public string ChaKanShiFouDouShenHeBaoMingRen(int year, string islocked)
        {
            return bo.ChaKanShiFouDouShenHeBaoMingRen(year, islocked);
        }

        public ObservableCollection<PublicOfficialSelectionModel> GetPublicOfficialSelectionForDaoChu(string tiaojian, int year, string islocked, int ExameID)
        {
            return bo.GetPublicOfficialSelectionForDaoChu(tiaojian, year,islocked, ExameID);
        }

        public string GetOrgIDbyDengLuRen(int ID)
        {
            return bo.GetOrgIDbyDengLuRen(ID);
        }

        public Dictionary<string, int> GetTypebyOrgID(int ID)
        {
            return bo.GetTypebyOrgID(ID);
        }

        public bool AddPublicOfficialSelectionModel(PublicOfficialSelectionModel item)
        {
            return bo.AddPublicOfficialSelectionModel(item);
        }


        public bool UpdatePublicOfficialSelectionModel(PublicOfficialSelectionModel item)
        {
            return bo.UpdatePublicOfficialSelectionModel(item);
        }


        public bool DetelePublicOfficialSelectionModel(string ID)
        {
            return bo.DetelePublicOfficialSelectionModel(ID);
        }

        public string GetOrgNamebyOrgID(int ID)
        {
            return bo.GetOrgNamebyOrgID(ID);
        }

        public bool SavePublicOfficialSelectionModel(string ID)
        {
            return bo.SavePublicOfficialSelectionModel(ID);
        }

        public int GetPublicOfficialSelectionCount(string OrgID, int ID, int status, int year, string islocked, int ExameID)
        {
            return bo.GetPublicOfficialSelectionCount(OrgID, ID, status, year, islocked, ExameID);
        }

        public bool CheckPublicOfficialSelectionModel(string ID)
        {
            return bo.CheckPublicOfficialSelectionModel(ID);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficialRecordAllForDaoChu(
            string PublicOfficialSelectionID)
        {
            return bo.GetPublicOfficialRecordAllForDaoChu(PublicOfficialSelectionID);
        }

        public bool TuiPublicOfficialSelectionModel(string ID, string memo)
        {
            return bo.TuiPublicOfficialSelectionModel(ID,memo);
        }

        
        public bool FaBuPublicOfficialSelectionModel(string ID,string fabutype)
        {
            return bo.FaBuPublicOfficialSelectionModel(ID, fabutype);
        }

        public string ChaKanShiFouDouShenHe(string OrgID, int year, string islocked)
        {
            return bo.ChaKanShiFouDouShenHe(OrgID,year, islocked);
        }

        public int GetPublicOfficialRecordCount(int OrgID, int year, string islocked,int examid)
        {
            return bo.GetPublicOfficialRecordCount(OrgID, year, islocked, examid);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficialRecord(int OrgID, int start, int end, int year, string islocked, int examid)
        {
            return bo.GetPublicOfficialRecord(OrgID, start, end, year, islocked, examid);
        }

        public ObservableCollection<PublicOfficialInfo> GetPublicOfficialInfo1(int status, int year)
        {
            return bo.GetPublicOfficialInfo(status,year);
        }
        
        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficialRecordbyID(int ID)
        {
            return bo.GetPublicOfficialRecordbyID(ID);
        }
        
        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficialRecordAll(int start, int end)
        {
            return bo.GetPublicOfficialRecordAll(start, end);
        }

        public bool CheckPublicOfficialRecordModel(string ID, string type)
        {
            return bo.CheckPublicOfficialRecordModel(ID,type);
        }

        public bool TuiPublicOfficialRecordModel(string ID, string memo)
        {
            return bo.TuiPublicOfficialRecordModel(ID, memo);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficialRecordbyEmpID(int ID, bool isc, int nian, string islocked, int exameid)
        {
            return bo.GetPublicOfficialRecordbyEmpID(ID, isc, nian,islocked,exameid);
        }

        public bool UpdatePublicOfficialRecordModelFenShu(PublicOfficialRecordModel model)
        {
            return bo.UpdatePublicOfficialRecordModelFenShu(model);
        }

        public bool BiShi(int ID)
        {
            return bo.BiShi(ID);
        }

        public bool CheXiaoBiShi(List<int> PublicOfficialRecordID)
        {
            return bo.CheXiaoBiShi(PublicOfficialRecordID);
        }

        public bool MianShi(List<int> ID)
        {
            return bo.MianShi(ID);
        }

        public bool CheXiaoMianShi(List<int> PublicOfficialRecordID)
        {
            return bo.CheXiaoMianShi(PublicOfficialRecordID);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetFenShuPublicOfficialRecordbyEmpID(string type, int nian, string fabutype, string islocked)
        {
            return bo.GetPublicOfficialRecordbyEmpID(type, nian, fabutype, islocked);
        }

        public ObservableCollection<ZhiWeiShiJianAnPaiModel> PublicOfficialSelectionForAnPai(int year, string tiaojian)
        {
            return bo.PublicOfficialSelectionForAnPai(year,tiaojian);
        }

        public bool InsertZu(ZhiWeiShiJianAnPaiModel model,string type)
        {
            return bo.InsertZu(model,type);
        }

        public Dictionary<int, int> GetMianShiRenShu(int PublicOfficialSelectionID,int year)
        {
            return bo.GetMianShiRenShu(PublicOfficialSelectionID,year);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficialRecordbyEmpIDForDaoChu(string ids,string kaoshileixing)
        {
            return bo.GetPublicOfficialRecordbyEmpIDForDaoChu(ids, kaoshileixing);
        }

        public bool CancelPublicOfficialSelectionModel(string ID)
        {
            return bo.CancelPublicOfficialSelectionModel(ID);
        }

        public bool CancelCheckPublicOfficialRecordModel(string ID, string type)
        {
            return bo.CancelCheckPublicOfficialRecordModel(ID,type);
        }

        public bool NiTongYiorNot(List<int> PublicOfficialRecordID, string istongyi)
        {
            return bo.NiTongYiorNot(PublicOfficialRecordID, istongyi);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetShenPi(int nian, string fabutype, string islocked, string orgids)
        {
            return bo.GetShenPi(nian,fabutype,islocked,orgids);
        }

        public bool UpdateShenPi(PublicOfficialRecordModel item)
        {
            return bo.UpdateShenPi(item);
        }

        public bool SuoPublicOfficialSelection(int ExamID)
        {
            return bo.SuoPublicOfficialSelection(ExamID);
        }

        public ObservableCollection<ZhiWeiShiJianAnPaiModel> PublicOfficialSelectionForAnPaiSuoDing(int year, string tiaojian)
        {
            return bo.PublicOfficialSelectionForAnPaiSuoDing(year, tiaojian);
        }

        public ObservableCollection<ZhiWeiShiJianAnPaiModel> GetOneAnPaiSuoDing(int id)
        {
            return bo.GetOneAnPaiSuoDing(id);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetMianShiTongZhiBiao(int year, string FaBuType,string mianshi)
        {
            return bo.GetMianShiTongZhiBiao(year, FaBuType,mianshi);
        }

        public ObservableCollection<PublicOfficialRecordModel> GetPublicOfficial(int year, string islocked)
        {
            return bo.GetPublicOfficial(year, islocked);
        }

        #region 通知
        public ObservableCollection<TongZhiModel> GetTongZhiModel(int year, int id)
        {
            return bo.GetTongZhiModel(year, id);
        }
        public bool AddTongZhiModel(TongZhiModel item)
        {
            return bo.AddTongZhiModel(item);
        }
        public bool UpdateTongZhiModel(TongZhiModel item)
        {
            return bo.UpdateTongZhiModel(item);
        }
        public bool DeteleTongZhiModel(int ID)
        {
            return bo.DeteleTongZhiModel(ID);
        }
        #endregion

        #region 考官
        public ObservableCollection<KaoGuanModel> GetKaoGuanModel(string name, int id, string isadmin, string kaoguantype)
        {
            return bo.GetKaoGuanModel(name, id,isadmin,kaoguantype);
        }
        public bool AddKaoGuanModel(KaoGuanModel item)
        {
            return bo.AddKaoGuanModel(item);
        }
        public bool UpdateKaoGuanModel(KaoGuanModel item)
        {
            return bo.UpdateKaoGuanModel(item);
        }
        public bool DeteleKaoGuanModel(string ID)
        {
            return bo.DeteleKaoGuanModel(ID);
        }
        #endregion

        #region 考官详细
        public ObservableCollection<KaoGuanModel> GetKaoGuanDetailModel(string name, int year, int id, string kaoguantype)
        {
            return bo.GetKaoGuanDetailModel(name, year,id,kaoguantype);
        }
        public bool AddKaoGuanDetailModel(KaoGuanDetailModel item)
        {
            return bo.AddKaoGuanDetailModel(item);
        }
        public bool AddKaoGuanDetailModelBykgids(string con, string type, int zljhid)
        {
            return bo.AddKaoGuanDetailModelBykgids(con, type, zljhid);
        }
        public bool UpdateKaoGuanDetailModel(KaoGuanDetailModel item)
        {
            return bo.UpdateKaoGuanDetailModel(item);
        }
        public bool DeteleKaoGuanDetailModel(int ID)
        {
            return bo.DeteleKaoGuanDetailModel(ID);
        }
        #endregion


        public ObservableCollection<PublicOfficialInfo> GetPublicOfficialInfo(string condition)
        {
            return bo.GetPublicOfficialInfo(condition);
        }

        public bool SavePublicOfficialInfo(PublicOfficialInfo entity, Files[] fs, string XamltempFile)
        {
            return bo.SavePublicOfficialInfo(entity, fs, XamltempFile);
        }

        public bool DeletePublicOfficialInfo(int id)
        {
            return bo.DeletePublicOfficialInfo(id);
        }


        public int GetRegisterPositionPageCount(string condition, int pagesize)
        {
            return bo.GetRegisterPositionPageCount(condition, pagesize);
        }

        public ObservableCollection<RegisterPosition> GetRegisterPosition(string condition, int pageindex, int pagesize)
        {
            return bo.GetRegisterPosition(condition, pageindex, pagesize);
        }

        public bool UpdateRegisterPosition(RegisterPosition entity)
        {
            return false;
        }

        public Emp_BasicInfoRegister GetEmp_BasicInfoRegister(string name, string idcard, int positionid)
        {
            return bo.GetEmp_BasicInfoRegister(name, idcard, positionid);
        }

        public bool Check(string CardNo, string Name, int status, int positionID)
        {
            return bo.Check(CardNo, Name, status, positionID);
        }


        public bool UploadFile(string path, string filename, byte[] content, bool Isfirst)
        {
            return bo.UploadFile(path, filename, content, Isfirst);
        }

        public ObservableCollection<Files> GetFiles(int parentid)
        {
            return new ObservableCollection<Files>(bo.GetFiles(parentid));
        }

        #region IPublicOfficialSelectionService Members


        

        #endregion


        public Emp_BasicInfoModel[] ValidateHasPhoto(string[] idcards, string loginUser)
        {
            return bo.ValidateHasPhoto(idcards, loginUser);
        }




        public bool UpdateHasPoto(string cardNo, bool HasPhoto, string filename)
        {
            return bo.UpdateHasPoto(cardNo, HasPhoto, filename);
        }

        public DownLoadFile DownLoadFile(DownLoadFile file)
        {
            return bo.DownLoadFile(file);
        }

        public ObservableCollection<RenQianKaoCha> GetKaoChaQingKuang(int orgID)
        {
            return bo.GetKaoChaQingKuang(orgID);
        }
        public ObservableCollection<RenQianTaoLun> GetRenQianTaoLun(int orgID)
        {
            return bo.GetRenQianTaoLun(orgID);
        }
        public ObservableCollection<RenQianGongShi> GetRenQianGongShi(int orgID)
        {
            return bo.GetRenQianGongShi(orgID);
        }
        public bool InsertRenQianKaoCha(RenQianKaoCha model)
        {
            return bo.InsertRenQianKaoCha(model);
        }
        public bool InsertRenQianTaoLun(RenQianTaoLun model)
        {
            return bo.InsertRenQianTaoLun(model);
        }
        public bool InsertRenQianGongShi(RenQianGongShi model)
        {
            return bo.InsertRenQianGongShi(model);
        }
        public bool QueRenZhuanRen(int ids)
        {
            return bo.QueRenZhuanRen(ids);
        }

        public bool QueRenShenQingZhuanRen(string ids)
        {
            return bo.QueRenShenQingZhuanRen(ids);
        }

        public bool ChechIsPublish(int id)
        {
            return bo.ChechIsPublish(id);
        }


        public bool UploadString(string tempFile, string content, bool IsFirst)
        {
            return bo.UploadString(tempFile, content, IsFirst);
        }

        public bool ShiFouYouFaBuZhiWei(int id)
        {
            return bo.ShiFouYouFaBuZhiWei(id);
        }

        public bool ShengChengZhunKaoZheng(int exameid, string zkz)
        {
            return bo.ShengChengZhunKaoZheng(exameid, zkz);
        }

        public ObservableCollection<LoginStatisticModel> GetDengLuRen(int ExameID,string dangtian)
        {
            return bo.GetDengLuRen(ExameID, dangtian);
        }
        //public FileStream ShengChengMianShiTongZhi(string EmpName)
        //{
        //    return ShengChengMianShiTongZhi(EmpName);
        //}


        public ObservableCollection<RenQianQueRen> GetRenQianQueRen(int orgID)
        {
            return bo.GetRenQianQueRen(orgID);
        }


        public bool InsertRenQianQueRen(RenQianQueRen model)
        {
            return bo.InsertRenQianQueRen(model);
        }

        public List<string> GetDengLuRenCount(int ExameID, string dangtian)
        {
            return bo.GetDengLuRenCount(ExameID, dangtian);
        }
    




public bool  UpdateKaoGuanDetailModelByids(string ids, string kgtype)
{
    return bo.UpdateKaoGuanDetailModelByids(ids,kgtype);
}

#region IPublicOfficialSelectionService 成员


public byte[] ExportKG(string name, int tj, string jhname)
{
    ObservableCollection<KaoGuanModel> tjfx = bo.GetKaoGuanDetailModel(name, tj, 0, "招录工作");
    HSSFWorkbook workbook = bo.ExportExcelKG(tjfx.ToList(), jhname);
    return  bo.ExcelToBytes(workbook);
}

#endregion

    }
}
